/**
 * 小方块类
 */

import { Points, IView } from "./types"

export class Square {

  private _point: Points = {
    x: 0,
    y: 0
  }
  private _color: string = ""

  // 属性：显示者
  private _viewer?: IView


  get viewer() {
    return this._viewer
  }
  set viewer(val) {
    this._viewer = val
    if (val) {
      val.show();
    }
  }

  get point() {
    return this._point
  }
  set point(val) {
    this._point = val
    // 坐标变化后完成显示
    if (this._viewer) {
      this._viewer.show()
    }
  }
  get color() {
    return this._color
  }
  set color(val) {
    this._color = val
  }
}
